package com.wjcxf;

import com.wjcxf.solution.BullsAndCowsSolution;
import com.wjcxf.struct.BullsAndCows;
import com.wjcxf.utils.CalcUtil;

import java.util.Scanner;

public class Main {
    //开始猜数字游戏
    public static void startGame(){
        BullsAndCows bullsAndCows = new BullsAndCows();
        bullsAndCows.init();
        Scanner scanner = new Scanner(System.in);
        while(true){
            int inputNumber = scanner.nextInt();
            bullsAndCows.validateGuessNumber(inputNumber);
            if(bullsAndCows.isGameOver()){
                System.out.println("You win!");
                System.out.println("是否重新开始游戏y/n?");
                String inputStr = scanner.next();
                if("y".equals(inputStr)){
                    bullsAndCows.init();
                }else{
                    break;
                }
            }
        }
    }
    //用筛法解决游戏
    public static void solution(){
        BullsAndCowsSolution b= new BullsAndCowsSolution();
        b.solution();
    }

    public static void autoSolution(){
        BullsAndCowsSolution b= new BullsAndCowsSolution();
        b.autoSolution();
    }
    public static void main(String[] args) {

        //startGame();
        //solution();
        autoSolution();

    }
}
